Mail Scripts
Introduction
MacOS X's Mail and Address Book have large AppleScript dictionaries which allow almost every aspect of these programs to be scripted. Since some features are rather cumbersome in the standard implementation, I decided to write some scripts to ease workflow. I started writing the scripts after the release of MacOS X 10.2 (Jaguar) and made several improvements and additions over time. After the release of MacOS X 10.3 (Panther) all scripts have been completely rewritten as AppleScript Studio applications allowing for many additional features.
Mail Scripts is a collection of AppleScript Studio applications for Mail and Address Book offering additional features or simplified workflow. Mail Scripts consists of the following scripts:
Add Addresses (Mail)
- Add addresses found in the selected messages (in the header fields "From", "To", "Cc", and "Bcc") to the Address Book. This is much more flexible than the "Add Sender to Address Book" available in Mail and provides a convinient way for creating mailing lists.
Archive Messages (Mail)
- Move messages from the selected mailbox(es) to an archive mailbox or export them to standard mbox or plain text files for backup purposes or import into other applications. You can select to move all messages or only messages sent within or certain period as well filter messages based on their read and flagged status.
Change SMTP Server (Mail)
- Switch between different already defined SMTP servers or define a new one. This is especially useful if you are using your computer in more than one location and have to switch servers for several accounts at once.
Create Rule (Mail)
- Create a new rule based on the first of the selected messages. This saves you the trouble of copy/pasting address or other info between the message and the rule window and provides a much quicker way for setting up a rule with multiple criteria/actions.
Remove Duplicates (Mail)
- Locate all duplicate messages found in the selected mailbox(es) and move them to a separate mailbox for easy removal (duplicate matching is based on the unique message header "Message-Id").
Schedule Delivery (Mail)
- Allows you to send individual messages at predefined times (this script uses iCal for scheduling message delivery).
Send all Drafts (Mail)
- Immediately send all messages in the "Drafts" folders for all accounts. This saves you from having to open each draft in order to send it.
Open Mailbox, Open Message (Mail)
- Two small faceless scripts which will open mailboxes with new messages or the new messages themselves when run as a rule action.
Filter Sent Messages (Mail)
- Another faceless scripts which will apply your rules to the messages in the "Sent" mailbox.
Export Addresses (Address Book)
- Export addresses from the Address Book into tab-delimited text files. You can select which groups and which fields you want to export.
Search Addresses (Address Book)
- Find all addresses inside the Address Book matching one or more criteria. As opposed to the "Search" function built into the Address Book, this lets you search in any field as well as for empty and non-empty fields (Note: due to a bug in the Address Book's AppleScript implementation, "First Name" will always return a non-empty value for system versions of at least up to 10.3.2 - I have reported this bug to Apple and hope that they fix it with the next system update).
- As an example, you might use this script to search for all phone numbers with a certain area code in order to update your contacts after an area code change.
After running the installer, the scripts are located inside a folder called "Mail Scripts" located inside your Applications folder (even though you can move the scripts to any other location of your liking, the installer will not remove previous versions located at a different path). You can run the scripts either from double-clicking their icons from within the Finder or using the launch scripts (or assigned keyboard shortcuts) from within the script menu inside Mail and Address Book (the script menu is the menu with the small icon to the lefft of the Help menu).
General Remark: Mail's AppleScript implementation does not seem to be able to handle too many request if Mail is busy doing something else. Some of the scripts seem to run better if you take all your accounts offline first (Choose "Mailbox->Online Status->Go Offline" from Mail's menu).
Add Addresses
- Select all messages you want to use for creating the mailing list (for creating a mailing list, you would choose all messages in a mailbox which contains all messages on a certain topic).
- Run the script and you get a list with all addresses contained in the selected messages - mark all the addresses you want to add to the Address Book using the checkboxes.
- From the popup menu, choose which group you want to update with the selected addresses or select "Create new Group..." and enter the name for the new group to be created.
- The script checks whether an address is already present before adding it to the Address Book in order to avoid duplicate entries. If additional information is available for an entry already present in the Address Book (e.g., full name information for an entry which had prior been email-only), the entry will be updated.
Archive Messages
- After starting the script, you will be presented with a list of your mailboxes - choose the ones you want to archive messages from using the checkboxes (note: mailboxes which don't contain any messages will not be displayed in the list).
- You now have the option to either perform an "Archive" or an "Export" of messages in the selected mailboxes. "Archive" moves the messages into a newly created Archive mailbox with the current date, "Export" leaves the messages in the mailboxes and generates text files in a location you can select.
- After selecting either of the buttons, you will be presented with a dialog which will allow you to specify options for your archive/export operation (filter messages based on dates, read and flagged status, output file format and location for export). Your selection (other than the dates which default to today for "before" and one year ago from today for "after") will be remembered when you run the script again.
- Note on export file formats: if you want to import your mail messages into another mail client, choose "mbox", a standard mailbox format which can be read by most programs. If you only care about the message text and want to minimize the overhead for your archive, select "text" and your files will be much smaller and easier to read.
Change SMTP Server
- When running the script, you will be presented with a dialog showing all your accounts with the currently selected SMTP server for each of them.
- Clicking an account's SMTP server displays a drop-down menu showing all SMTP servers that have been added to Mail. Choose the desired SMTP server for each individual account (accounts for which the SMTP server has been changed will display a checkmark in the checkbox to the left of the account's name).
- After making your selections, click the "Change" button to change the settings for all accounts at once.
Create Rule
- Select the message you want to base your new rule on (only the first message will be considered) and run the script.
- In the script's main window, you can rename the rule, select the criteria you want to base your rule on, and choose one or more action to be performed for new incoming messages matching the criteria. Note - per default, there will be one criteria for the subject and each address in all the mail's headers - you can change the values for each of these headers in the list.
- The new rule will be created at the end of your existing rules.
Remove Duplicates
- After starting the script, you will be presented with a list of your mailboxes - using the checkboxes, choose the ones you want to scan for duplicate messages. Note: messages will be compared to other messages on a per-mailbox basis.
- Run the script and all duplicate messages will be moved to a new mailbox called "Duplicate Messages" - upon completion of the script you will get a dialog telling you the number of messages the script found. Note: depending on the number of messages you are scanning, this operation might take a long time.
- After checking the duplicate messages you can now delete the "Duplicate Messages" folder to get rid of the duplicates.
Schedule Delivery
- The script will present you with a list of all messages in your Drafts mailbox, allowing to set, change, and remove schedules for individual messages.
- The script uses iCal for scheduling the message deliveries (iCal 1.5.2 or higher is recommended) - it will create a new calendar called "MailScripts" for message sending events. Please make sure that your computer is running at the time you scheduled for message delivery - if the computer was shut down or asleep, messages will be sent as soon as the computer is running again.
- Note: the scripts uses Message-IDs to keep track of which message it should send. Since Mail changes the Message-ID when you change a draft saved previously, you will have to re-schedule message delivery after changing a scheduled message.
Send all Drafts
- Running this script will immediately send all messages found in any of the "Drafts" folders - if you have an active internet connection (otherwise they will stay in the Outbox and will be sent as soon as your connection is active again).
- If you run the script and there are no messages in your "Drafts" folders, the script will quit immediately without giving you any feedback.
Open Mailbox, Open Message
- Both these scripts are faceless applications which should be run as a rule action and will then act on the message(s) triggering the rule, either openeing the mailbox with the new message(s) or the new message(s) themselves in a new window. Just choose either of these scripts (located in ~/Library/Scripts/Mail Scripts/) for the "Run AppleScript" rule action.
Filter Sent Messages
Mail does not apply rules to sent messages - if you want to organize your sent messages in mailboxes together with your received messages, you have to manually select all messages in your "Sent" mailbox and choose "Apply Rules to Selection" from the menu. This script tries to automate this for you.
Note: this script is somewhat ugly and slower than Mail's internal apply rules command - things would be so much easier if Mail would allow rules to be applied to sent messages or at least supply an AppleScript command "apply rules to selection". Please let Apple know that they should add this in future versions of Mail.
- When the script is run, it applies your rules to all messages which have been sent after the last time the script was run (this means that the script should be faster since it won't check messages not matching any rule every time - if you added a new rule (i.e., the total number of rules defined in Mail changes) all messages will be checked again).
- The script only performs "Move Message to Mailbox ..." actions (honoring "Stop Evaluating Rules") - "Copy Message to Mailbox" actions would result in potentially many duplicate messages and most other actions don't really make sense for sent messages.
- The script makes the following assumptions:
- Since you are the sender of all your sent messages, rules "Sender is in my Address Book" and "Sender is in my Previous Recipients" will always be true (and their respective opposites false).
- "Sender is (not) Member of Group" conditions will be ignored - Address Book lookups would make the script too unresponsive since it would have to launch the Address Book application.
- "Message is (not) addressed to my full name" conditions will be ignored - since you sent the messages, it is fairly unlikely that they are addressed to you as well.
- In order to automatically filter all your sent messages, create a new rule at the beginning of your rules, set to match "Every Message" and run the script as its only rule action. This will trigger the script every time your receive a message - this is as "real-time" as currently possible.
Export Addresses
- Select the groups you want to export using the checkboxes. If you select to export groups, the script will create a file called "<Group>.txt" for each of the selected groups on your Desktop, otherwise all addresses will be written to a file called "Contacts.txt" on your Desktop. Note: files with the same name on your Desktop will be overwritten!
- When choosing "Export", you will be presented with a dialog sheet which allows you to select the fields you want to include in the export. These selections will be stored for the next time you run the script.
- In the script's main window, you can define one or more criteria for your search. The fields "Name", "Address", "Email", and "Phone" will search in any of the fields listed below these header field, searching in unspecified address fields (e.g., "Street") will search the corresponding field for all addresses, regardless of the address type.
- You can enter multiple criteria for a search in the following way: "[a,b]" will search for entires with either "a" or "b" (be sure not to include additional spaces inside the brackets and make sure that the brackets are the first and last character of your search string). If you need to include a comma in your search string within "[...]", use "\,".
- If you entered more than one criteria, you can either match any or all of them ("OR" vs. "AND" search).
- While the script performs the search, the list of criteria will be updated with the number of contacts matched for each criteria.
- Once the search is complete, the script will show you a list of the contacts which matched your search and gives you the option to add them to a group in the Address Book.
-
Some of the scripts will not work properly when FileVault is enabled. This is due to some major bugs in AppleScript when FileVault is used. The problems mainly occur when files are being written - try selecting a location outside your encrypted home folder for the generated files.
- Some scripts might give random errors at times (NSReceiverEvaluationScriptError: 4 being a more common one). This is due to the fact that some of the scripts (mainly "Remove Duplicates" and "Archive Messages") are hammering Mail with AppleEvents. When Mail is busy doing something else while listening/replying to those events, an error might occur. If you encounter this issue, the following might help:
- take all accounts offline from within Mail before running the script
- force Mail to rebuild all its index files: in the Mailbox drawer, make sure that your mailbox hierarchy is fully expanded (all triangles pointing down), then click on the very first mailbox in the list, shift-click on the very last mailbox (this will select all mailboxes). In the message list preview, you will now see a list of all your messages in all your mailboxes. Wait until Mail stops displaying the spinning wheel in the top right corner of its window and the number of messages displayed stops increasing
Disclaimer
I wrote these scripts for my own personal use and they work for me. Mail Scripts are provided "as-is" and I don't take any responsability for the integrity of your mail and address data.
Mail Scripts are distributed free of charge - I decided to make them available for the Macintosh community. I have a day job and I will still survive if nobody sends me money - I am happy with hearing that I saved someone's day with my little scripts. However, donations are not turned away;-) - please use this link to make a secure donation through the PayPal system.
Mail Scripts may not be redistributed via the web or any other electronic media except with explicit written consent by the author.
System Requirements
Since Apple decided to change the AppleScript implementation between system version 10.2 and 10.3, Mail Scripts require MacOS X 10.3 or higher as of version 2.0. The latest version running on MacOS X 10.2 is still available but development has been frozen for that version. The scripts should run properly on every computer which is able to run MacOS X.
Download Link
You can get the latest version of the scripts here (2MB). Users still running MacOS X 10.2.x can download version 1.3.7 here (218kB)
If you want to look at the source code of the various scripts, you can download a project (Xcode version 1.5) with the complete source (1.6MB) - don't blame me if you don't understand everything or screw up your system by changing some of the code;-) If you decide that my code is useful and use some of it in your own projects, please add proper credit and mention my scripts.
Mail Scripts are currently fully localized in the following languages: English (development language), German, Dutch (translation by Guy De Lee), French (translation by Sébastien Marty), and Italian (translation by Marcello Teodori). Please contact me if you want to help localizing to other languages.
2.5.2 (January 21, 2005)
New features:
- French localization courtesy of Sébastien Marty.
- Italian localization courtesy of Marcello Teodori.
Improvements/bugfixes:
- (Add Addresses): Make sure that the progress bar is visible when adding the addresses to the Address Book so that we can see that the script is still working and estimate when it will finish.
- (Archive Messages): Make sure that we don't create any files or folders starting with a "." when exporting messages to disk - the Finder won't like this...
- (Archive Messages): Fixed bug with improper selection of read and flagged status.
- (Archive Messages): Updated to latest versions of MIME::Tools (5.417) and MailTools (1.66).
- (Search Addresses): Fix searching in birthdays - before only "is empty" worked properly, now all the searches should be fine.
2.5.1 (January 8, 2005)
Improvements/bugfixes:
- Fixed a bug in the Installer which would result in an AppleScript error when trying to install on a non-English system version
Note: This release does not contain any changes to the actual scripts - you only have to install it if the installer for 2.5 failed
2.5 (January 7, 2005)
New features:
- Filter Sent Messages - new script (located in the scripts menu in Mail) which will apply your rules to all your sent messages. This helps you file your sent messages automatically.
Improvements/bugfixes:
- (Archive Messages): Fixed bug when archiving multiple mailboxes while preserving the hierarchy which would result in an AppleScript error before ('Can't make «class mbxp» "MailboxName" of «class mact» "AccountName" of application "Mail" into a Unicode text (-1700)').
- (Archive Messages): Make sure that exported messages in mbox format actually do conform to the mbox standard. Since messages on IMAP servers apparently don't start with the initial line required by the mbox file format, we add one during export.
- (Archive Messages): Changed structure of internal mailbox cache - archiving messages in 2.4.3 could in some cases lead to the wrong mailbox(es) being archived (since the cache got confused after adding the Archive mailbox).
- (Archive Messages): Updated to the latest version of HTML::Parser (3.45).
- (Search Addresses): Fixed error 'Can't get character 1 of ""' when searching Address Book fields and specifying "is empty" or "is not empty."
2.4.3 (December 16, 2004)
Improvements/bugfixes:
- (Archive Messages): Updated to the latest version of HTML::Parser (3.43).
- (Schedule Delivery): Worked around a race condition in order to avoid the dialog "Please save your messages as drafts..." which sometimes would appear after a successful scheduled sending of a message.
- (Archive Messages, Create Rule, Remove Duplicates): Made mailbox selection process more robust (we now cache the reference to the mailbox itself instead of trying to recreate it from its name).
- (Export Addresses): Fixed a bug which would make the script fail to export any addresses when no groups are present in the Address Book (Successfully exported "0 Address").
- (Export Addresses): When exporting multiple contacts with the same "full name" (e.g., multiple people within the same company which have been marked as "This is a Company" in the Address Book), the script would produce duplicates in the exported file - this has been fixed.
- (Export Addresses): Corrected wrong summary dialog (referencing "Archive Messages") in the German version.
- (Export Addresses, Search Addresses): Change "Title" to "Prefix" (in the English version of the scripts) in order to be consistent with the Address Book naming conventions.
- Several internal code optimizations for streamlining the localization process and sorting multi-dimensional lists.
2.4.2 (November 29, 2004)
New features:
- (Search Addresses): Added option to search for multiple values within the same field at once. One example of such a search would be finding all contacts in a local area by looking for a list of ZIP codes. See Usage for details of the new feature.
- (Search Addresses): Added searching of individual address fields (street, city, state, ZIP code, country).
Improvements/bugfixes:
- (Archive Messages): Fixed problem with options dialog not always reflecting the proper selection for the output structure.
- (Archive Messages): An empty "Archive Name" now works properly - when exporting into one file per message, no additional folder is generated inside the selected location; when exporting into a single file, the "Archive Name" is used instead of the default name inside a folder with the archive name.
- (Archive Messages): Make sure to limit the maximum length for the filename to 255 characters when exporting into on file per message.
- (Archive Messages): Updated to latest versions of HTML::Parser (3.40) and MailTools (1.65).
- (Search Addresses): Make sure to clean the previous result list when "Modify Search" or "New Search" are chosen after a search.
2.4.1 (October 30, 2004)
Improvements/bugfixes:
- (Archive Messages): When exporting into text files with the option "One File per Message", we now make sure to create a new file for each message even if there is more than one message from the same person with the same subject on a given day.
- (Archive Messages): Updated to latest version of MIME::Tools (5.415).
2.4 (October 21, 2004)
New features:
- (Archive Messages): When exporting messages (to either text or mbox files), you can now select to have one file per message. In this case, the file name will be comprised of the sender name, date sent, and message subject.
- (Archive Messages): When exporting messages to text files, you can now choose whether you want long lines to be broken, specifying the maximum number of characters per line (message quote levels will be preserved).
Improvements/bugfixes:
- (Add Addresses): Moved the code to check whether the Address Book is running to the proper place so that it actually works. We now also quit the Address Book unless it has been running when the script was started and the user selects "Cancel" to abort the script or simply closes its window.
- (Add Addresses): Fixed error "Can't get item 0 of {}" for users which didn't have any groups defined in the Address Book.
- (Archive Messages): When exporting to plain text files, we now use our own text parser for all messages (even text/plain) in order not to lose message quotes (AppleScript's "get content of message" will strip the quote chars from the beginning of each line).
- (Archive Messages): Fixed problem when exporting messages encoded with UTF-8 to plain text files.
- (Archive Messages): Added quoting for text/enriched messages when exporting to plain text files (quote level is given by the <excerpt> tags inside the message).
- (Archive Messages): Updated to latest version of MIME::Tools (5.414).
- (Change SMTP Server): It is now possible to change all acounts to a new SMTP server without having to choose the corresponding entry for each of the accounts in the list.
- (Schedule Delivery): Made the script independent of the date format set in the System Preferences - we should not get the error "Invalid date and time 1/1/2004" any more.
2.3.2 (October 3, 2004)
Improvements/bugfixes:
- (Archive Messages): When exporting messages as plain text, make sure to use the proper character encoding in the Perl script for messages not handled by Mail so that non-ASCII characters now show up properly in all cases (use Unicode::Map8 from CPAN for this).
- (Archive Messages): When exporting messages as plain text, handle <blockquote> in HTML messages (start lines with proper level of "> ") to make it easier to distinguish the original message from included quotes.
- (Archive Messages): Fixed "Mail got an error: NSReceiverEvaluationScriptError: 4 (1)" error which would occur when trying to export a message with no "Content-Type" header to plain text.
2.3.1 (September 30, 2004)
Improvements/bugfixes:
- An improved quick sort implementation used in 2.3 broke some things (e.g., the "Add Addresses" script was returning "The variable theGroups is not defined. (-2753)") - fixed this.
2.3 (September 29, 2004)
New features:
- (Archive Messages): when exporting messages into text files, richt text and HTML messages are now exported as well. Since Apple has still not fixed the bugs in Mail's AppleScript implementation, I wrote my own parser to generate plain text versions. The parser is written in Perl and relies heavily on two modules from the CPAN archive: MIME::Tools and HTML::Parser. Since both these packages are not part of the standard system installation, they are packaged within the application itself.
The parser has the following specifications:
- For multipart/alternative messages, the "text/plain" part is used
- "text/html" and "text/enriched" parts will be converted to a plain text version, trying to preserve formatting as much as possible
- Links inside <a> tags in "text/html" messages will be extracted and inserted next to the link text
- Attachments and pictures will be referenced within the message, if possible showing their name and location
Improvements/bugfixes:
- The Installer now works even for users who have FileVault enabled. Note: since Apple decided to break lots of things in AppleScript when FileVault is enabled, some of the scripts might still not work (see known issues)
2.2.5b - Maintenance Release (September 4, 2004)
Improvements/bugfixes:
- More fixes to the installer in order to prevent the "NSArgumentsWrongScriptError (6)" message some users had been getting
Note: This release does not contain any changes to the actual scripts - you only have to install it if the installer for 2.2.5 failed
2.2.5 (August 31, 2004)
Improvements/bugfixes:
- (Change SMTP Server): Make sure that accounts set up using the httpmail-plugin (hotmail.com, msn.com) will not show up in the list since they don't use a real SMTP server for sending mail. Looks like a change in the httpmail-plugin broke the earlier solution...
- Major re-write of the Installer - this should have the following advantages:
- A few people reported problems with the previous Installer failing - the new Installer seems to work for those people
- The Installer now works even when the BSD subsystem is not installed
- Since the Installer will no longer dynamically build some of the scripts, speed is much improved
2.2.4 (August 29, 2004)
Improvements/bugfixes:
- (Add Addresses): Quit the Address Book after adding the new addresses unless it has been running before the script started
- (Change SMTP Server): Rewrote the script to allow changing to different SMTP servers for individual accounts in a single run
- (Create Rule): Added ability to choose custom sounds installed in ~/Library/Sounds/ for the "Play Sound" action
- (Search Addresses): Fixed problem with the delete button for search criteria not working in certain situations
- Fixed problem with the Installer which could lead to duplicated installations when upgrading to a new version
- Upgraded project to Xcode 1.5, taking advantage of some new features (native targets, additional code optimizations, ...)
- Some cosmetic improvements (e.g., button size within tables decreased)
2.2.3 (July 9, 2004)
Improvements/bugfixes:
- The Installer now installs the scripts into the current user's application folder (~/Applications/) instead of the global applications folder if the current user does not have admin rights.
- (Schedule Delivery): Fixed a problem which could result in an error message being displayed when more than one mail was scheduled to be sent at the same time.
2.2.2 (June 16, 2004)
New features:
- (Remove Duplicates): Added option to "Ignore Headers" when comparing duplicate messages. This is option will test for duplicates based on Message-ID and message content (ignoring white space) and provides a little more relaxed definition of duplicates.
Improvements/bugfixes:
- Worked around a problem introduced by the Apple Security Update 2004-06-07 which could result in an error -10814 when running the scripts from the scripts menu (thanks to Benjamin Han for a enlightening discussion about and solutions to this problem!)
- Fixed an Installer problem which would erroneously report a missing BSD subsystem for some users (thanks to Paul Jones and Web Maestro Clay in helping me track down this issue!)
- (Open Mailbox): The script should now work more reliably when the mailbox to be opened is an account inbox (i.e., running the script without a "Move Message" action in the rule)
2.2.1 (May 23, 2004)
New features:
- (Create Rule): You can now select "Any Recipient" as rule condition for any of the addresses in the currently selected message
Improvements/bugfixes:
- (Export Addresses): Internal code clean-up for enabling checkboxes in the export field selection
- (Open Mailbox): Fixed several bugs which would prevent the script to work properly in some cases
2.2 (May 20, 2004)
New features:
- Open Mailbox - new script (located in the scripts menu in Mail) which - when run as a rule action - will open a new window showing the mailbox where new incoming messages have been moved to
- Open Message - new script (located in the scripts menu in Mail) which - when run as a rule action - will open new incoming messages in their own windows
- (Create Rule): Added "Stop evaluating rules" to the list of possible rule actions
Improvements/bugfixes:
- (Add Addresses, Export Addresses): The script should now be able to deal with spurios groups which don't have a name without getting an AppleScript error
- (Remove Duplicates): Move duplicates immediately after they are found instead of at the end of processing a mailbox. This will enable you to pick back up where you left in case AppleScript or Mail decide to throw an error.
2.1.7 (May 9, 2004)
Improvements/bugfixes:
- (Add Addresses): Fixed problem with parsing names which would result in an error message for some addresses in mails sent from Outlook
- (Archive Messages, Remove Duplicates): Disable automatic mail checks while the script does all its work in order not to put too much load on Mail
- (Change SMTP Server): Get rid of the AppleScript error "The variable SMTPName is not defined." for users having the httpmail plugin installed (the plugin creates dummy SMTP accounts which are lacking some of the required information and fail to return some properties)
- (Remove Duplicates): Make sure that the counter in the main window and the dialog at the end will always display the correct number of duplicates found
- If a previous version of the scrips was installed at a location different from the standard one, the Installer will now try to update the files at that location. This should prevent duplicate versions and the possibility of launching an old version of the scripts
2.1.6 (April 26, 2004)
New features:
- (Search Addresses): Double-clicking a name in the result list will now open the contact's card in the Address Book
Improvements/bugfixes:
- (Create Rule): If the script is run on a message located in a mailbox other than the InBox, the mailbox will be preselected for the "move" and "copy" commands to avoid loading the entire mailbox hierarchy unless needed
- (Create Rule): Make sure that no duplicate addresses will show up in the criteria list for messages having identical addresses in the various headers
- (Remove Duplicates): Duplicates will now be found within IMAP and .Mac mailboxes as well (a different format of the local IMAP cache had prevented this before)
- (Send all Drafts): Messages which are still being edited (auto-saved drafts created from messages still being edited in an open window) will now no longer be sent when running this script
- The Installer now updates the Launch Services database after installing the Scripts - this should prevent the message "Finder got an error: An error of type -10814 has occurred. Do you want to edit this script?" from appearing when running the scripts from the script menu for users installing "Mail Scripts" for the first time
2.1.5 (April 17, 2004)
New features:
- (Create Rule): Add popup button to select location for the newly created rule in relation to the rules already present
- (Create Rule): Made all sender and recipient addresses available for both send and receive rules to facilitate easier rule setup
Improvements/bugfixes:
- (Archive Messages, Remove Duplicates): Improved startup time by showing all mailboxes instead of only mailboxes containing messages. This should (hopefully!) get rid of the "AppleScript timeout" problem
- (Create Rule): Fixed problem which could make the script produce an AppleScript error and stop working when trying to move or copy to a mailbox whose name contained certain unicode characters
- (Create Rule): Fixed bug which would prevent the script from setting one of the the standard Mail sounds as a rule action.
- Fixed bug which could result the scripts to hang if the user clicked into a list during lenghty operations
- Speed up and streamline the Installer
2.1.4 (March 20, 2004)
New features:
- (Archive Messages): Added option to change the default name for the archive mailbox and export folder. This allows archiving/exporting to the same mailbox/folder every time. Custom names will be remembered between runs - to restore the default naming (with the current date) select an empty name
- (Add Addresses): Added popup button to select the label to be used for the imported addresses in the Address Book
Improvements/bugfixes:
- (Remove Duplicates): Make progress bar and "Cancel" button somewhat more responsive during message comparison
- (Add Addresses): Corrected problem which would result in an AppleScript error message ("The variable theGroups is not defined. (-2753)") when no groups are defined in the Address Book
2.1.3 (March 10, 2004)
Improvements/bugfixes:
- (Add Addresses): Change lookup of email addresses in the Address Book to case-insensitive
- (Archive Messages): Revert ouput location to default value in case the last export has been made to a folder no longer present on the system in order to avoid "folder not found" error messages
- (Schedule Delivery): Make checking for whether iCal is running or not a little quicker and more robust in order to avoid a Finder error
- Various internal script improvements and clean-up
2.1.2 (March 3, 2004)
Improvements/bugfixes:
- (Export Addresses): Fixed bug which would result in the AppleScript error message "Can't make month of missing value into a string. (-1700)" when trying to export birth dates for people which didn't have one entered
- (Archive Messages, Remove Duplicates): Speed up initial loading of mailboxes
- (Remove Duplicates): Tried to work around all AppleScript timeout errors and make script a little faster and more responsive
2.1.1 (February 1, 2004)
Improvements/bugfixes:
- (Schedule Delivery): Fixed bug which would result in the AppleScript error message "The variable theWindow is not defined. (-2753)"
- (Schedule Delivery): Corrected typo in the Dutch localization
2.1 (January 31, 2004)
New features:
- Schedule Delivery - automatically send messages at a later time. Every message in the Drafts can be individually scheduled to be sent at a specific time
2.0.2 (January 5, 2004)
New features:
- Dutch localization courtesy of Guy De Lee
- The names of the scripts are now localized, both in the Finder and in the Scripts menu (the localization in the Scripts menu uses the current user's preferred language setting at the time of installation)
Improvements/bugfixes:
- Notify the user during installation if the BSD package is missing instead of displaying some obscure generic AppleScript error
- Corrected some tool tips in the various scripts
- Made some improvements when selecting mailboxes with accented characters in their name (there seems to be some bug in Mail's AppleScript implementation)
- (Archive Messages, Remove Duplicates): speed up scanning of mailbox hierarchy in order to avoid script timeout errors which could occur for mailboxes with many messages in them
- (Remove Duplicates): completely re-wrote the script making use of some command line tools. This greatly improves the speed of the script and should avoid various AppleScript errors which could appear before (NSCannotCreateScriptCommandError (10), NSReceiverEvaluationScriptError (4), and NSInternalScriptError (8) were reported before)
2.0.1 (December 27, 2003)
Improvements/bugfixes:
- Fixed some problems which would prevent the installer from installing the launch scripts at the proper location (they would end up on the HD's root directory instead) and various AppleScript errors with the installer when FileVault was turned on
Note: There is no need to download the new version if the installer worked for you before, there are no changes to the scripts themselves
2.0 (December 26, 2003)
New features:
- All scripts have been completely rewritten as AppleScript Studio applications and now require MacOS X 10.3 or higher. (Since the AppleScript dictionaries of 10.2.x and 10.3.x for Mail and Address Book are not compatible with each other, Mail Scripts 2.0 will not run on system versions before 10.3 and I won't be able to write a version able to run on 10.2.x either...)
- All scripts now have interfaces giving the user feedback about the current status. The new GUI shold also be much more straightforward, utilizing single dialogs instead of a succession of several dialogs for the individual options.
- Scripts are installed into the application-specific script menus for Mail and Address Book making the system-wide scripts menu unnecessary for the operation of Mail Scripts
- In addition to the standard English interface, the scripts have been completely localized in German - please contact me if you want to help localizing to other languages
Improvements/bugfixes:
- "quick sort" is now used for all sorting done inside the various scripts (instead of the simple ASCIISort used before) - this speeds up sorting on long lists considerably (quick sort scales with O(n log n) whereas ASCIISort scales with O(n2). Many thanks to Markus Kaspar for providing the original AppleScript implementation of quick sort)
- (Add Addresses - renamed from Manage Mailing Lists): Full name information is now added for new contacts; the script should parse most name formats properly and put the information in the correct fields
- (Archive Messages): Consolidated "Archive Messages" and "Export Messages" into a single script. Messages can now be also selected based on their read and flagged status.
- (Create Rule): Updated to support new rules actions introduced in Mail with MacOS X 10.3
- (Remove Duplicate Messages): Improved speed and hopefully prevent a possible stack overflow in AppleScript which would manifest itself by the error message "The variable theHeaders is not defined". In my tests, the script ran fine on a total of more than 10,000 messages - string handling in AppleScript is not exactly fast though...
- (Send all Drafts): Drafts with attachments will now be send as well, the attachments will be preserved
- (Export Addresses): Updated to support new fields introduced with MacOS X 10.3
- (Export Addresses): Output files will now be sorted according to the preference setting "Display Order" in the Address Book
- (Search Addresses): Updated to support new fields introduced with MacOS X 10.3
- (Search Addresses): Display search results within the script - creating a group from the search results is now an option.
1.3.7 (February 8, 2003)
Improvements/bugfixes:
- (Export Addresses) the addresses in the output file are now sorted alphabetically (by last name, then first name)
1.3.6 (February 2, 2003)
New features:
- (Manage Mailing List - renamed from "Create Mailing List") present the user with a list of groups already present so you don't have to enter the group name to update an existing group
- (Export Messages) added option to export multiple messages into a single text file in order to create a message digest
Improvements/bugfixes:
- (Export Addresses) convert new-line characters in street addresses to ", " in order to create a properly formatted text file
- (Export Messages) fixed a problem which would cause the script to stop when trying to export a message without a subject. These messages will now have "<No Subject>" in their file name
- (Export Messages) when exporting messages with the same subject and the same date, create individual files for each message instead of appending subsequent messages to the first file (starting with the second message, files will have a number appended to their filename)
1.3.5 (December 29, 2002)
Improvements/bugfixes:
- (Export Messages) added an option to export only minimal headers ("To:", "From:", "Cc:", "Bcc:", and "Subject:") when writing to text files
- (Export Messages) fixed a problem where the script would give an error message ("Bad name for file" or "File ... wasn't found") when the message subject contained certain characters and the messages was exported into a text file
1.3.4 (December 3, 2002)
Improvements/bugfixes:
- (Export Addresses) removed the additional tab character which was added to the beginning of every line
- (Send all Drafts) messages in the drafts folder which contain attachments will be skipped - there is no way of accessing attachments from AppleScript and the attachments would be lost when trying to send those messages
1.3.3 (November 28, 2002)
New features:
- (Export Messages) - added option to export messages as text files (one file per message) instead of mbox files
Improvements/bugfixes:
- (Create Mailing List) fixed a problem which would produce an AppleScript error when trying to add addresses to a mailing list which were not already present in the Address Book (this error probably appeared due to the new feature in Address Book with MacOS X 10.2.2 which now shows the email address instead of <No Name> for email-only entries)
1.3.2 (November 10, 2002)
New features:
- (Search Addresses) - entering "*" as the search value will now find any non-empty values in that field (wildcard search)
Improvements/bugfixes:
- (Export Addresses) removed additional header "Name" which was written to the output file
- (Export Addresses) corrected mismatch between data and column headers (reversed order of zip code and state)
1.3.1 (October 13, 2002)
Improvements/bugfixes:
- (Export Messages) fixed problem which would produce an error when trying to export all messages
- (Export Messages, Archive Messages) slight speed improvement when exporting/archiving messages independent of the message age
1.3 (October 11, 2002)
New features:
- Archive Messages - move messages from the selected mailbox(es) to an archive mailbox. You can select to move all messages or only messages older than a certain number of days
- Export Messages - export messages to standard mbox files for backup purposes or to import them into other mail programs
Improvements/bugfixes:
- Save preferences independently of the BSD subsystem by using script properties. This made the code smaller and safer
- (Export Addresses) added option to export all contacts at once
- (Export Addresses) renamed some of the column headers in the output file to ease import into Entourage
- (Remove Duplicate Messages) move the duplicates to a mailbox called "Duplicate Messages" located at the root of your mailboxes instead of deleting them immediately
- (Create Rule) added option to create a mailbox on the fly when making a new "Transfer" rule. The new mailbox will be located at the root level of your mailboxes
1.2.2 (October 9, 2002)
Improvements/bugfixes:
- We finally should never get messages like "Cannot convert '10.2.1' into a number" any more
- Fixed a problem where the user would be presented with a cryptic error message when the BSD subsystem was not installed. We now tell the user about the missing BSD subsystem upon installation (the scripts still work but no preferences will be saved)
1.2.1 (September 22, 2002)
Improvements/bugfixes:
- Fixed a problem which would manifest itself in the display of the message "Could not parse [...] try single quoting it." when running "Change SMTP Server" and some of the accounts had spaces in their name
1.2 (September 22, 2002)
New features:
- Send all Drafts - immediately send all messages in the "Drafts" folders for all accounts
- Remove Duplicate Messages - delete all duplicate messages found in the selection
- Search Addresses - find all addresses inside the Address Book matching one or more criteria
Improvements/bugfixes:
- New folder layout so we don't clutter the Script Menu
- Save all scripts as applications so that they can be run from any location and not just the Script Menu
- Added some more error checking to the installer script
- (Create Rule) show IMAP folders and subfolders inside the standard mailboxes (In, Out, ...) for "Transfer..." rules
- (Export Addresses) let the user decide whether to include the full name in the output file
- (Export Addresses) reverse order of ZIP and city in the output file
1.1.1 (September 15, 2002)
Improvements/bugfixes:
- Work around the 'Cannot convert "10.2" to a number' problem. This happened when the decimal separator in the System Preferences was set to anything other than "." (e.g., the standard setting in Germany is ",")
1.1 (September 14, 2002)
New features:
- Add an install script for easy installation of the scripts
- Export Addresses - export addresses from the Address Book into tab-delimited text files
- Create Mailing List - create and update mailing list from all addresses found in the selected messages
Improvements/bugfixes:
- Sort the list of mailboxes when creating "Transfer..." rules
1.0 (September 13, 2002)
Initial release ("Create Rule" & "Change SMTP Server")